import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/layout/index'
import MobileLayout from '@/layout/mobile'

export const routes = [
  {
    path: '/',
    redirect: '/login',
    component: Layout,
    children: [
      {
        path: 'overview',
        name: 'Overview',
        component: () => import('../views/overview/index.vue'),
        meta: { title: '数据总览' }
      },
      {
        path: 'analysis',
        name: 'Analysis',
        component: () => import('../views/analysis/index.vue'),
        meta: { title: 'AI智能分析' }
      },
      {
        path: 'device',
        name: 'Device',
        component: () => import('../views/device/index.vue'),
        meta: { title: '设备管理' }
      },
      {
        path: 'knowledge',
        name: 'Knowledge',
        component: () => import('../views/knowledge/index.vue'),
        meta: { title: '知识库管理' }
      },
      {
        path: 'events',
        name: 'Events',
        component: () => import('../views/events/index.vue'),
        meta: { title: '事件类型定义' }
      },
      {
        path: 'vedio',
        name: 'Vedio',
        component: () => import('../views/vedio/index.vue'),
        meta: { title: '预警视频管理' }
      },
      {
        path: 'vision',
        meta: { title: '可视化数据大屏' }
      },
    ]
  },
  {
    path: '/',
    redirect: '/setting',
    component: Layout,
    children: [
      {
        path: 'setting',
        name: 'Setting',
        component: () => import('../views/setting/index.vue'),
        meta: { title: '系统设置' }
      },
      {
        path: 'company',
        name: 'Company',
        component: () => import('../views/setting/company.vue'),
        meta: { title: '企业管理' }
      },
      {
        path: 'addCompany',
        name: 'AddCompany',
        component: () => import('../views/setting/addCompany.vue'),
        meta: { title: '设置企业' }
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/login/index.vue'),
    hidden: true
  },
  {
    path: '/screen',
    name: 'Screen',
    component: () => import('../views/screen/index.vue'),
    hidden: true
  },
  {
    path: '/mobile',
    redirect: '/mobile/index',
    component: MobileLayout,
    children: [
      {
        path: 'index',
        name: 'MobileIndex',
        component: () => import('../views/mobile/index.vue'),
        meta: { title: '首页' }
      },
      {
        path: 'video',
        name: 'MobileVideo',
        component: () => import('../views/mobile/video.vue'),
        meta: { title: '首页' }
      },
      {
        path: 'my',
        name: 'MobileMy',
        component: () => import('../views/mobile/my.vue'),
        meta: { title: '首页' }
      },
    ]
  },
]



const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
